<?php

/**
 * BonCommandeFournisseur form base class.
 *
 * @method BonCommandeFournisseur getObject() Returns the current form's model object
 *
 * @package    SdCommerce
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseBonCommandeFournisseurForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'                           => new sfWidgetFormInputHidden(),
      'duree_validite'               => new sfWidgetFormInputText(),
      'date_piece'                   => new sfWidgetFormDate(),
      'date_livraison'               => new sfWidgetFormDate(),
      'reference_piece'              => new sfWidgetFormInputText(),
      'observation'                  => new sfWidgetFormInputText(),
      'date_echeance'                => new sfWidgetFormDate(),
      'id_modepaiement'              => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('ModalitePaiement'), 'add_empty' => true)),
      'echance_cb'                   => new sfWidgetFormChoice(array('choices' => array('Jours' => 'Jours', 'Semaines' => 'Semaines', 'Mois' => 'Mois', 'Années' => 'Années'))),
      'id_fournisseur'               => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Fournisseur'), 'add_empty' => true)),
      'duree_echance'                => new sfWidgetFormInputText(),
      'valider'                      => new sfWidgetFormInputCheckbox(),
      'id_departement'               => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Departement'), 'add_empty' => true)),
      'bon_livraison_fournisseur_id' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('BonLivraisonFournisseur'), 'add_empty' => true)),
      'created_at'                   => new sfWidgetFormDateTime(),
      'updated_at'                   => new sfWidgetFormDateTime(),
    ));

    $this->setValidators(array(
      'id'                           => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
      'duree_validite'               => new sfValidatorInteger(array('required' => false)),
      'date_piece'                   => new sfValidatorDate(),
      'date_livraison'               => new sfValidatorDate(),
      'reference_piece'              => new sfValidatorString(array('max_length' => 20)),
      'observation'                  => new sfValidatorString(array('max_length' => 100, 'required' => false)),
      'date_echeance'                => new sfValidatorDate(array('required' => false)),
      'id_modepaiement'              => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('ModalitePaiement'), 'required' => false)),
      'echance_cb'                   => new sfValidatorChoice(array('choices' => array(0 => 'Jours', 1 => 'Semaines', 2 => 'Mois', 3 => 'Années'), 'required' => false)),
      'id_fournisseur'               => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Fournisseur'), 'required' => false)),
      'duree_echance'                => new sfValidatorNumber(array('required' => false)),
      'valider'                      => new sfValidatorBoolean(array('required' => false)),
      'id_departement'               => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Departement'), 'required' => false)),
      'bon_livraison_fournisseur_id' => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('BonLivraisonFournisseur'), 'required' => false)),
      'created_at'                   => new sfValidatorDateTime(),
      'updated_at'                   => new sfValidatorDateTime(),
    ));

    $this->widgetSchema->setNameFormat('bon_commande_fournisseur[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'BonCommandeFournisseur';
  }

}
